package cn.tedu.sims.mapper;

import cn.tedu.sims.pojo.dto.RoleDTO;
import cn.tedu.sims.pojo.entity.Power;
import cn.tedu.sims.pojo.entity.Role;
import cn.tedu.sims.pojo.entity.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RoleMapper {

    int insert(Role role);

    /**
     * 添加角色和权限关系
     * @param powerId
     * @param roleId
     */
    void insertRolePower(@Param("powerId") Long powerId,@Param("roleId") Long roleId);

    int deleteById(Long id);

    /**
     * 删除角色和权限关系
     *
     * @return
     */
    int deleteByRolePower(Long roleId);

    List<Role> list();

    List<Role> selectByWd(String wd);

    Role getStandardById(Long id);

    int update(Role role);

    int countByName(String name);

    int countById(Long id);

    int countByPower(List<Long> longs);

    List<User> selectByRoleId(Long id);

    List<Power> selectPower();

    String roleByUsername(String username);

    List<Power> selectPowerBySon(Long id);

    List<Long> selectPowerExist(Long id);




    /*;


    void deleteByU_R(int id);
    //编辑页面查询
    Role selectByRole(int id);

    void updateById(Role role);

    List<Power> selectByPower();*/
}
